<?php 
	
	include("pagina_restrita.php"); 
		
	$id =(int)$_GET['id'];
	
	// abre conexão com banco de dados
	require("funcoesBD.php");
	conectarBancoDados();

	$result = mysql_query("SELECT id_professor FROM professor WHERE id_professor = '$id'");	
	$row = mysql_fetch_array($result);
				
	if($id == $row['id_professor']){
				
		$pesquisa = mysql_query("DELETE FROM professor WHERE id_professor = '$id'");
		
		if(!$pesquisa) {
			header("Location: professor.php?status=falied");
		}
		
		header("Location: professor.php?status=removido");
		
	} else {
		 
		header("Location: professor.php?status=erro");
	}	
?>
